<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>
        <style>
            html,
            body {
                padding: 0;
                margin: 0;
            }

            #app {
                margin-top: 100px;
                column-count: 3;
                column-gap: 10px;
                width: 700px;
                margin: 50px auto;
            }

            .pic-item {
                width: 200px;
                margin-bottom: 10px;
                border:1px solid #999;
                break-inside: avoid;
            }
        </style>
    </head>

    <body>
        <div id="app">
            <div class="pic-item" v-for='(item,index) in imgList' :key='index' :style="{height:item.height,background:item.background}">{{item.title + index}}</div>
        </div>

        <script>
            const vm = new Vue({
                el: '#app',
                data: {
                    imgList: []
                },
                mounted() {
                    this.initData()
                },
                methods: {
                    proRandom(start, end) {
                        return Math.floor(Math.random() * (end - start) + start)
                    },
                    initData(){
                        this.imgList = Array(20).fill(1).map(item => {
                        const color1 = this.proRandom(0, 255)
                        const color2 = this.proRandom(0, 255)
                        const color3 = this.proRandom(0, 255)
                        return {
                            height: this.proRandom(100, 300) + 'px',
                            background: `rgb(${color1},${color2},${color3})`,
                            title: 'kaak'
                        }
                    })
                    }
                }
            })

        </script>
    </body>

</html>